#-*-coding:utf-8-*-
from PySide2.QtWidgets import *
from PySide2.QtGui import *
from PySide2.QtCore import *
import sys
import os

class AddShot(QWidget):

    def __init__(self):
        super(AddShot,self).__init__()

        current_dir=os.path.dirname(__file__)
        self.PROJECT_INFO_PATH=os.path.join(os.path.dirname(current_dir),'projects')


        self.setWindowTitle('添加新镜头')

        self.mainLayout=QVBoxLayout()
        self.mainLayout.setAlignment(Qt.AlignCenter)
        self.mainLayout.setSpacing(30)

        self.projectName_layout=QHBoxLayout()
        self.projectName_label=QLabel('项目名称:')
        self.projectName=QLabel('狮子王')
        self.projectName_comb=QComboBox()
        self.projectName_layout.addWidget(self.projectName_label)
        self.projectName_layout.addWidget(self.projectName)
        self.projectName_layout.addWidget(self.projectName_comb)

        self.departmentName_layout=QHBoxLayout()
        self.departmentName_label=QLabel('部门:')
        self.departmentName=QLabel('特效')
        self.departmentName_comb=QComboBox()
        self.departmentName_layout.addWidget(self.departmentName_label)
        self.departmentName_layout.addWidget(self.departmentName)
        self.departmentName_layout.addWidget(self.departmentName_comb)

        self.epi_layout=QHBoxLayout()
        self.epi_label=QLabel('集数/场数:')
        self.epi_edit=QLineEdit()
        self.epi_layout.addWidget(self.epi_label)
        self.epi_layout.addWidget(self.epi_edit)

        self.shotname_layout=QHBoxLayout()
        self.shotname_label=QLabel('镜头名:')
        self.shotname_edit=QLineEdit()
        self.shotname_layout.addWidget(self.shotname_label)
        self.shotname_layout.addWidget(self.shotname_edit)

        self.artistname_layout=QHBoxLayout()
        self.artistname_label=QLabel('制作者:')
        self.artistname=QLabel('Master')
        self.artistname_comb=QComboBox()
        self.artistname_layout.addWidget(self.artistname_label)
        self.artistname_layout.addWidget(self.artistname)
        self.artistname_layout.addWidget(self.artistname_comb)

        self.btn_layout=QHBoxLayout()
        self.OK_btn=QPushButton('创建')
        self.NO_btn=QPushButton('取消')
        self.btn_layout.addWidget(self.OK_btn)
        self.btn_layout.addWidget(self.NO_btn)


        self.mainLayout.addLayout(self.projectName_layout)
        self.mainLayout.addLayout(self.departmentName_layout)
        self.mainLayout.addLayout(self.epi_layout)
        self.mainLayout.addLayout(self.shotname_layout)
        self.mainLayout.addLayout(self.artistname_layout)
        self.mainLayout.addLayout(self.btn_layout)

        self.setLayout(self.mainLayout)

        #预设项目列表
        self.setProjectCombobox()


    def setProjectCombobox(self):
        projectList=os.listdir(self.PROJECT_INFO_PATH)
        self.projectName_comb.addItems(projectList)


    def setPojectName(self):
        comb_text=self.projectName_comb.currentText()



    def no_btn(self):
        self.close()

if __name__ == '__main__':
    app=QApplication(sys.argv)
    ad=AddShot()
    ad.show()
    sys.exit(app.exec_())
